package com.frank.stock4j.dataloader.controller;

import com.frank.stock4j.dataloader.common.RespInfo;
import com.frank.stock4j.dataloader.service.LoadDataService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping(value = "loader")
public class LoadController {
    @Autowired
    LoadDataService service;

    @GetMapping(value = "load")
    public RespInfo<Boolean> load(@RequestParam String beanName) {
        service.load(beanName);
        return RespInfo.ok(true);
    }

    @GetMapping(value = "stop")
    public RespInfo<Boolean> stop(@RequestParam String beanName) {
        service.stop(beanName);
        return RespInfo.ok(true);
    }
}
